package com.fenrirtec.aepp.portal.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.fenrirtec.aepp.common.condition.MemberCondition;
import com.fenrirtec.aepp.common.dto.TenderEnrollListDto;
import com.fenrirtec.aepp.common.service.impl.TenderEnrollServiceImpl;
import com.fenrirtec.aepp.portal.common.action.CommonAction;

public class OneRegistrationRcordAction  extends CommonAction{
	private static final long serialVersionUID = 1L;
	private Integer tenderId;
	private TenderEnrollListDto tenderEnrollListDto;
	private static final Logger logger = LoggerFactory.getLogger(OneRegistrationRcordAction.class);

	public String init() {
		if (logger.isInfoEnabled()) {
			logger.info("[OneRegistrationRcordAction#init] start.");
		}
		HttpServletRequest reqeust= ServletActionContext.getRequest();
		String strTenderId = reqeust.getParameter("tenderId");
		String memberLoginName = reqeust.getParameter("memberLoginName");
		if (strTenderId != null){
			tenderId = Integer.valueOf(strTenderId);
			MemberCondition condition = new MemberCondition();
			condition.setTenderId(tenderId);
			condition.setMemberLoginName(memberLoginName);
			if(tenderEnrollListDto == null){
				tenderEnrollListDto=new TenderEnrollServiceImpl().searchByCnd(condition).get(0);
			}
		}else{
			tenderId = 0;
		}
		if (logger.isInfoEnabled()) {
			logger.info("[OneRegistrationRcordAction#init] finish.");
		}
		return SUCCESS;
	}

	public TenderEnrollListDto getTenderEnrollListDto() {
		return tenderEnrollListDto;
	}

	public void setTenderEnrollListDto(TenderEnrollListDto tenderEnrollListDto) {
		this.tenderEnrollListDto = tenderEnrollListDto;
	}
	
	
}
